<template>
	<el-container>
		<el-main class="nopadding">
			<scTable ref="table" :params="{password:this.password}" :apiObj="apiObj" row-key="recordId" stripe remoteSort remoteFilter>
				<el-table-column label="#" type="index" width="50"></el-table-column>
				<el-table-column label="人员姓名" prop="userName" width="100"></el-table-column>
				<el-table-column label="年度" prop="year" width="150"></el-table-column>
				<el-table-column label="月份" prop="month" width="150"></el-table-column>
				<el-table-column label="应发合计" prop="sumAmount" width="150">
					<template #default="scope">
						{{ scope.row.sumAmount }}/元
					</template>
				</el-table-column>
				<el-table-column label="实扣费用" prop="realCost" width="150">
					<template #default="scope">
						{{ scope.row.careFunds }}/元
					</template>
				</el-table-column>
				<el-table-column label="实发工资" prop="realSalary" width="150" :show-overflow-tooltip="true">
					<template #default="scope">
						{{ scope.row.realSalary }}/元
					</template>
				</el-table-column>
				<el-table-column label="操作" fixed="right" align="right" width="100">
					<template #default="scope">
						<el-button-group>
							<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
						</el-button-group>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
	<recordDetails v-if="dialog.detailsSave" ref="detailsDialog" @closed="dialog.detailsSave=false"></recordDetails>
</template>

<script>
import recordDetails from '@/views/hr/salary/create/details'
export default {
	name: 'My Work Manage',
	components: {
		recordDetails,
	},
	data() {
		return {
			dialog: {
				detailsSave:false,
			},
			password:'',
			apiObj:'' ,
		}
	},
	mounted() {
		this.$prompt('请输入账号登录密码', '用户身份确认', {confirmButtonText: '确定',cancelButtonText: '取消'}).then(({ value }) => {
			if (!value ) {
				this.$alert("登录密码不能为空", "提示", {type: 'error'})
			}else{
				this.password = value
				this.apiObj = this.$API.hr.hrSalary.getMyHrSalaryRecordList;
			}
		}).catch(() => {
			this.$message({type: 'info', message: '取消操作'});
		})
	},
	methods: {
		//查看
		table_show(row) {
			this.dialog.detailsSave = true
			this.$nextTick(() => {
				this.$refs.detailsDialog.open().setData(row)
			})
		},
		//本地更新数据
		handleSaveSuccess() {
			this.$refs.table.refresh()
		},
	}
}
</script>

<style>
</style>
